import type { Api_Response_Dto } from '@/dto/response/Api_Response_Dto';
import request from '@/utils/request'


/**
 * 获取字典类别列表
 * @param obj
 * @returns
 */
export const get_Dictionary_Types = (obj: { page: number; limit: number; key: string; }):
    Promise<Api_Response_Dto> => {
    return request({
        url: "api/dictionary/get_Dictionary_Types",
        method: "get",
        params: obj
    });
}

/**
 * 删除类别
 * @param obj
 * @returns
 */
export const delete_Dictionary_Types = (obj: { id: string }):
    Promise<Api_Response_Dto> => {
    return request({
        url: "api/dictionary/delete_Dictionary_Types",
        method: "post",
        data: obj
    });
}

/**
 * 获取单个类别
 * @param obj
 * @returns
 */
export const get_Single_Dictionary_Type = (obj: { id: string }):
    Promise<Api_Response_Dto> => {
    return request({
        url: "api/dictionary/Get_Single_Dictionary_Type",
        method: "get",
        params: obj
    });
}

/**
 * 删除字典
 * @param obj
 * @returns
 */
export const del_dictionarys = (obj: { id: string }):
    Promise<Api_Response_Dto> => {
    return request({
        url: "api/dictionary/delete_dictionarys",
        method: "post",
        data: obj
    });
}


/**
 * 新增字典
 * @param obj
 * @returns
 */
export const Add_Dictionary = (obj: {  name: string; value: string; explain: string;dtid:string,discount:string }):
    Promise<Api_Response_Dto> => {
    return request({
        url: "api/dictionary/Add_Dictionary",
        method: "post",
        data: obj
    });
}

/**
 * 新增字典类型
 * @param obj
 * @returns
 */
export const Add_Dictionary_type = (obj: { name: string;key:string; value: string; explain: string; }):
    Promise<Api_Response_Dto> => {
    return request({
        url: "api/dictionary/Add_Dictionary_type",
        method: "post",
        data: obj
    });
}


/**
 * 修改字典类别
 * @param obj
 * @returns
 */
export const Update_Dictionarys = (obj: { id: string; name: string; value: string; key: string }):
    Promise<Api_Response_Dto> => {
    return request({
        url: "api/dictionary/Update_Dictionarys",
        method: "get",
        params: obj
    });
}
